#include "SuperMonster.h"

SuperMonster::SuperMonster(float x, float y, float z):Monster(x, y, z) {
	this->monsterBox->setBox(x - 5.5F, y - 5.5F, z - 1.0F, 11.0F, 11.0F, 2.0F);
	score = 150;
}

void SuperMonster::init() {
	this->coord->setCoord3D(this->initCoord->x, this->initCoord->y, this->initCoord->z);
	this->tir->setCoord3D(this->coord->x, this->coord->y, this->coord->z);
	this->coordCharger->setCoord3D(this->coord->x, this->coord->y, this->coord->z);
	this->monsterBox->setBox(this->coord->x - 5.5F, this->coord->y - 5.5F, this->coord->z - 1.0F, 11.0F, 11.0F, 2.0F);
	isOnFire = false;
	isVisible = true;
	isCharger = false;
}

void SuperMonster::draw(){
	if (isVisible) {
		glPushMatrix();

		if (isOnFire) {
			glPushMatrix();
			glMaterialfv(GL_FRONT,GL_DIFFUSE,jaune);
			glTranslatef(this->tir->x, this->tir->y, this->tir->z);
			Figure::drawCuboid(1.0, 2.0, 1.0 );
			glPopMatrix();
		}

		glPushMatrix();
		if (isCharger) {
			glTranslatef(this->coordCharger->x, this->coordCharger->y, this->coordCharger->z);
		} else {
			glTranslatef(this->coord->x, this->coord->y, this->coord->z);
		}
	
		// haut	
		glMaterialfv(GL_FRONT,GL_DIFFUSE,rouge);
		glPushMatrix();
		glTranslatef( 0.0F, 3.0F, 0.0F);
		Figure::drawCuboid( 1.0F, 5.0F, 2.0F );
		glTranslatef( -1.0F, 0.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
		glTranslatef( -1.0F, -1.0F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
		glTranslatef( -1.0F, -0.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 1.0F, 2.0F );

		glTranslatef( 4.0F, 1.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
		glTranslatef( 1.0F, -1.0F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
		glTranslatef( +1.0F, -0.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 1.0F, 2.0F );
		glPopMatrix();
		glMaterialfv(GL_FRONT,GL_DIFFUSE,blanc);

		//cote
		glMaterialfv(GL_FRONT,GL_DIFFUSE,bleu);
		glPushMatrix();
		glTranslatef(-5.0F, 2.0F, 0.0F );
		Figure::drawCuboid( 1.0F, 5.0F, 2.0F );
		glTranslatef(1.0F, -2.5F, 0.0F );
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
		glTranslatef(1.0F, -1.0F, 0.0F );
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
		glTranslatef(1.0F, -1.0F, 0.0F );
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
	
		glTranslatef(4.0F, 0.0F, 0.0F );
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
		glTranslatef(1.0F, 1.0F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
		glTranslatef(1.0F, 1.0F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 2.0F );
		glTranslatef(1.0F, 2.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 5.0F, 2.0F );
		glPopMatrix();
		glMaterialfv(GL_FRONT,GL_DIFFUSE,blanc);

		//centre
		glMaterialfv(GL_FRONT,GL_DIFFUSE,jaune);
		glPushMatrix();
		glTranslatef(0.0F, -2.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 6.0F, 1.0F);
	
		glTranslatef( -1.0F, 3.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 3.0F, 1.0F);
		glTranslatef( -1.0F, -1.0F, 0.0F);
		Figure::drawCuboid( 1.0F, 3.0F, 1.0F);
		glTranslatef( -1.0F, 0.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 1.0F);
		glTranslatef( -1.0F, 1.0F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 1.0F);
	
		glTranslatef( 5.0F, -0.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 3.0F, 1.0F);
		glTranslatef( 1.0F, -1.0F, 0.0F);
		Figure::drawCuboid( 1.0F, 3.0F, 1.0F);
		glTranslatef( 1.0F, 0.5F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 1.0F);
		glTranslatef( 1.0F, 1.0F, 0.0F);
		Figure::drawCuboid( 1.0F, 2.0F, 1.0F);
		glPopMatrix();
		glMaterialfv(GL_FRONT,GL_DIFFUSE,blanc);

		glPopMatrix();
		glPopMatrix();
	}
}
